package homework.exp02;

import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class G {
    static Scanner cin = null;

    static {
        try {
            cin = new Scanner(new FileReader(new File("G.in")));
        } catch (IOException e) {
            cin = new Scanner(System.in);
        }
    }

    static String sourceCode = "";

    public static void main(String[] args) {
        while (cin.hasNextLine()) {
            sourceCode += cin.nextLine();
        }
        String pattern = "(if|int|for|while|do|return|break|continue)|" +
                "(,|;|\\{|\\}|\\(|\\))|" +
                "(\\+|\\-|\\*|/|=)|" +
                "(>|<|==|>=|<=|!=)|" +
                "([a-zA-Z]+\\w*)|" +
                "(\\d+)";
        Pattern p = Pattern.compile(pattern);
        Matcher m = p.matcher(sourceCode);
        String[] a = {"if", "for", "while", "do", "int", "return", "break", "continue"};
        String[] b = {",", ";", "{", "}", "(", ")"};
        String[] c = {"+", "-", "*", "/", "="};
        String[] d = {">", "<", "==", ">=", "<=", "!="};
        String[] e = new String[10];
        String[] f = new String[10];
        int ee = 0, ff = 0;
        while (m.find()) {
            String token = m.group();
            int tokenType = 0;
            int tokenAttribute = 0;
            if (m.group(1) != null) {
                tokenType = 1;
                for (int i = 0; i < a.length; i++) {
                    if (m.group(1).equals(a[i])) {
                        tokenAttribute = i + 1;
                    }
                }
            } else if (m.group(2) != null) {
                tokenType = 2;
                for (int i = 0; i < b.length; i++) {
                    if (m.group(2).equals(b[i])) {
                        tokenAttribute = i + 1;
                    }
                }
            } else if (m.group(3) != null) {
                tokenType = 3;
                for (int i = 0; i < c.length; i++) {
                    if (m.group(3).equals(c[i])) {
                        tokenAttribute = i + 1;
                    }
                }
            } else if (m.group(4) != null) {
                tokenType = 4;
                for (int i = 0; i < d.length; i++) {
                    if (m.group(4).equals(d[i])) {
                        tokenAttribute = i + 1;
                    }
                }
            } else if (m.group(5) != null) {
                tokenType = 6;
                int position = -1;
                for (int i = 0; i < e.length; i++) {
                    if (m.group(5).equals(e[i])) {
                        position = i;
                        break;
                    }
                }
                if (position == -1) {
                    position = ee;
                    e[ee] = m.group(5);
                    ee++;
                }
                tokenAttribute = position + 1;
            } else if (m.group(6) != null) {
                tokenType = 5;
                int position = -1;
                for (int i = 0; i < f.length; i++) {
                    if (m.group(6).equals(f[i])) {
                        position = i;
                        break;
                    }
                }
                if (position == -1) {
                    position = ff;
                    f[ff] = m.group(6);
                    ff++;
                }
                tokenAttribute = position + 1;
            }
            System.out.println("(" + token + "," + tokenType + "," + tokenAttribute + ")");
        }
        System.out.println("Anysis End");
    }
}